<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>  
	
<%
	String path = request.getContextPath();
%>	
<!doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="copyright" content=""/>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
	<title>设置-社交账号</title>
	<link href="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
	<link href="${pageContext.request.contextPath}/css/system/public.css" />
	<link href="${pageContext.request.contextPath}/css/system/set.css" />
	<link href="${pageContext.request.contextPath}/css/marketing/activity.css" />
	<link href="../favicon.ico" rel="shortcut icon">
	<!-- 提出引入 -->
	<link href="${pageContext.request.contextPath}/css/system/alert.css" /> 
	<!--  -->
	<link href="<%=path%>/hplus/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
	<link href="<%=path%>/hplus/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
	<link href="<%=path%>/hplus/css/plugins/iCheck/custom.css" rel="stylesheet">
	<link href="<%=path%>/hplus/css/animate.min.css" rel="stylesheet">
	<link href="<%=path%>/hplus/css/style.min862f.css?v=4.1.0" rel="stylesheet">
	
	<style type="text/css">
		.button {  
		    display: inline-block;  
		    zoom: 1; /* zoom and *display = ie7 hack for display:inline-block */  
		    *display: inline;  
		    vertical-align: baseline;  
		    margin: 0 2px;  
		    outline: none;  
		    cursor: pointer;  
		    text-align: center;  
		    text-decoration: none;  
		    font: 14px/100% Arial, Helvetica, sans-serif;  
		    padding: .5em 2em .55em;  
		    text-shadow: 0 1px 1px rgba(0,0,0,.3);  
		    -webkit-border-radius: .5em;   
		    -moz-border-radius: .5em;  
		    border-radius: .5em;  
		    -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);  
		    -moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);  
		    box-shadow: 0 1px 2px rgba(0,0,0,.2);  
		}  
		.button:hover {  
		    text-decoration: none;  
		}  
		.button:active {  
		    position: relative;  
		    top: 1px;  
		}  
		  
		.bigrounded {  
		    -webkit-border-radius: 2em;  
		    -moz-border-radius: 2em;  
		    border-radius: 2em;  
		}  
		.medium {  
		    font-size: 12px;  
		    padding: .4em 1.5em .42em;  
		}  
		.small {  
		    font-size: 11px;  
		    padding: .2em 1em .275em;  
		} 
		
		/* color styles   
---------------------------------------------- */  
  
		/* black */  
		.black {  
		    color: #d7d7d7;  
		    border: solid 1px #333;  
		    background: #333;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#666), to(#000));  
		    background: -moz-linear-gradient(top,  #666,  #000);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#666666', endColorstr='#000000');  
		}  
		.black:hover {  
		    background: #000;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#444), to(#000));  
		    background: -moz-linear-gradient(top,  #444,  #000);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#444444', endColorstr='#000000');  
		}  
		.black:active {  
		    color: #666;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#000), to(#444));  
		    background: -moz-linear-gradient(top,  #000,  #444);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#000000', endColorstr='#666666');  
		}  
		  
		/* gray */  
		.gray {  
		    color: #e9e9e9;  
		    border: solid 1px #555;  
		    background: #6e6e6e;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#888), to(#575757));  
		    background: -moz-linear-gradient(top,  #888,  #575757);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#888888', endColorstr='#575757');  
		}  
		.gray:hover {  
		    background: #616161;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#757575), to(#4b4b4b));  
		    background: -moz-linear-gradient(top,  #757575,  #4b4b4b);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#757575', endColorstr='#4b4b4b');  
		}  
		.gray:active {  
		    color: #afafaf;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#575757), to(#888));  
		    background: -moz-linear-gradient(top,  #575757,  #888);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#575757', endColorstr='#888888');  
		}  
		  
		/* white */  
		.white {  
		    color: #606060;  
		    border: solid 1px #b7b7b7;  
		    background: #fff;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed));  
		    background: -moz-linear-gradient(top,  #fff,  #ededed);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed');  
		}  
		.white:hover {  
		    background: #ededed;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#dcdcdc));  
		    background: -moz-linear-gradient(top,  #fff,  #dcdcdc);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#dcdcdc');  
		}  
		.white:active {  
		    color: #999;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#fff));  
		    background: -moz-linear-gradient(top,  #ededed,  #fff);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#ffffff');  
		}  
		  
		/* orange */  
		.orange {  
		    color: #fef4e9;  
		    border: solid 1px #da7c0c;  
		    background: #f78d1d;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#faa51a), to(#f47a20));  
		    background: -moz-linear-gradient(top,  #faa51a,  #f47a20);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#faa51a', endColorstr='#f47a20');  
		}  
		.orange:hover {  
		    background: #f47c20;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));  
		    background: -moz-linear-gradient(top,  #f88e11,  #f06015);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015');  
		}  
		.orange:active {  
		    color: #fcd3a5;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#f47a20), to(#faa51a));  
		    background: -moz-linear-gradient(top,  #f47a20,  #faa51a);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#f47a20', endColorstr='#faa51a');  
		}  
		  
		/* red */  
		.red {  
		    color: #faddde;  
		    border: solid 1px #980c10;  
		    background: #d81b21;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#ed1c24), to(#aa1317));  
		    background: -moz-linear-gradient(top,  #ed1c24,  #aa1317);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#ed1c24', endColorstr='#aa1317');  
		}  
		.red:hover {  
		    background: #b61318;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#c9151b), to(#a11115));  
		    background: -moz-linear-gradient(top,  #c9151b,  #a11115);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#c9151b', endColorstr='#a11115');  
		}  
		.red:active {  
		    color: #de898c;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#aa1317), to(#ed1c24));  
		    background: -moz-linear-gradient(top,  #aa1317,  #ed1c24);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#aa1317', endColorstr='#ed1c24');  
		}  
		  
		/* blue */  
		.blue {  
		    color: #f4f7f9;  
		    border: solid 1px #03a9f4;  
		    background: #0095cd;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#03a9f4), to(#03a9f4));  
		    background: -moz-linear-gradient(top,  #00adee,  #0078a5);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5');  
		}  
		.blue:hover {  
		    background: #007ead;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#0095cc), to(#00678e));  
		    background: -moz-linear-gradient(top,  #0095cc,  #00678e);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#0095cc', endColorstr='#00678e');  
		}  
		.blue:active {  
		    color: #80bed6;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#0078a5), to(#00adee));  
		    background: -moz-linear-gradient(top,  #0078a5,  #00adee);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#0078a5', endColorstr='#00adee');  
		}  
		  
		/* rosy */  
		.rosy {  
		    color: #fae7e9;  
		    border: solid 1px #b73948;  
		    background: #da5867;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#f16c7c), to(#bf404f));  
		    background: -moz-linear-gradient(top,  #f16c7c,  #bf404f);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#f16c7c', endColorstr='#bf404f');  
		}  
		.rosy:hover {  
		    background: #ba4b58;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#cf5d6a), to(#a53845));  
		    background: -moz-linear-gradient(top,  #cf5d6a,  #a53845);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#cf5d6a', endColorstr='#a53845');  
		}  
		.rosy:active {  
		    color: #dca4ab;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#bf404f), to(#f16c7c));  
		    background: -moz-linear-gradient(top,  #bf404f,  #f16c7c);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#bf404f', endColorstr='#f16c7c');  
		}  
		  
		/* green */  
		.green {  
		    color: #e8f0de;  
		    border: solid 1px #538312;  
		    background: #64991e;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#7db72f), to(#4e7d0e));  
		    background: -moz-linear-gradient(top,  #7db72f,  #4e7d0e);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#7db72f', endColorstr='#4e7d0e');  
		}  
		.green:hover {  
		    background: #538018;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#6b9d28), to(#436b0c));  
		    background: -moz-linear-gradient(top,  #6b9d28,  #436b0c);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#6b9d28', endColorstr='#436b0c');  
		}  
		.green:active {  
		    color: #a9c08c;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#4e7d0e), to(#7db72f));  
		    background: -moz-linear-gradient(top,  #4e7d0e,  #7db72f);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#4e7d0e', endColorstr='#7db72f');  
		}  
		  
		/* pink */  
		.pink {  
		    color: #feeef5;  
		    border: solid 1px #d2729e;  
		    background: #f895c2;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#feb1d3), to(#f171ab));  
		    background: -moz-linear-gradient(top,  #feb1d3,  #f171ab);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#feb1d3', endColorstr='#f171ab');  
		}  
		.pink:hover {  
		    background: #d57ea5;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#f4aacb), to(#e86ca4));  
		    background: -moz-linear-gradient(top,  #f4aacb,  #e86ca4);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#f4aacb', endColorstr='#e86ca4');  
		}  
		.pink:active {  
		    color: #f3c3d9;  
		    background: -webkit-gradient(linear, left top, left bottom, from(#f171ab), to(#feb1d3));  
		    background: -moz-linear-gradient(top,  #f171ab,  #feb1d3);  
		    filter:  progid:DXImageTransform.Microsoft.gradient(startColorstr='#f171ab', endColorstr='#feb1d3');  
		}
    </style>
</head>
<body class="gray-bg">
	<div class="s_popup_delect2" style="z-index: 9999999999999999999">
		<div class="s_consum" onblur="self.focus()">
			<p id="dialog_title"></p>
		</div>
	</div>
    <div class="wrapper wrapper-content animated fadeInRight">
	     <div class="row">
	          <div class="s_binding col-md-12">            
	              <p>
	                  <img src="${pageContext.request.contextPath}/images/system/s_weibo.png" />
	                  <a href="javascript:;" class="k_weibo">绑定微博</a>
	                  <a href="javascript:;" class="s_weibo_relieve">解除绑定</a>
	
	
	                  <img src="${pageContext.request.contextPath}/images/system/s_email.png" />
	                  <a href="javascript:;" class="k_email">绑定邮箱</a>
	                  <a href="javascript:;" class="s_email_relieve">解除绑定</a>
	
	                  <span class="s_fk_pic1">
	                    <img src="${pageContext.request.contextPath}/images/system/s_check_no.png" _id="1" /> 首页显示
	                  </span>
	                  
	                 
	                  <span id = "msg3" style="color: red;">${sessionScope['org.springframework.web.servlet.support.SessionFlashMapManager.FLASH_MAPS'][0]["Vcode"]}</span>
	                                    <!--新加入 -->
	                  <span id = "msg" style="color: red;"></span>
	                  <span id = "msg1" style="color: red;"></span>
	              </p>
	                   <!-- 关键字 -->
		                  <ul class="s_basics_list form" style="width: 99%;padding-left: 1%" >
		                  	<li style="background-color: white;margin-top:15px">
		                        <span style="margin-left: 3%;width: 100px;margin-top: 10px"><font size="4">关键字</font></span>
		                        <button class="button blue" style="margin-left: 10px" onclick="saveKW()">保存</button>
		                        <div class="form s_keyword">
		                            <input type="text" placeholder="请输入关键字" id="i" style="margin-left: 3%	;width: 300px;margin-top: 1%"/>
		                            <span id = "s">Enter确认</span>
		                        </div>
		                        <br />
		                        <div class="key fix" id="kf">
		                        </div>
		                    </li>  
		                   </ul>
	                   <!-- 关键字 end-->
	          </div>
     </div>
      
    </div>
    
     <!-- 解除绑定微博弹出框 -->
    <div class="s_popup">
        <div class="issue">
            <span><img src="${pageContext.request.contextPath}/images/system/close.png" /></span>
            <h4><img src="${pageContext.request.contextPath}/images/system/warning.png" /> 解除绑定微博</h4>
            <p>解除绑定后，您将无法获取微博线索,也无法与微博客户联系,确定解绑微博？</p>
            <ol class="fix">
                <li><a style="width: 100px;height: 40px;display: block;" href="javascript:;" class="s_cancel">取消</a></li>
                <li><a style="width: 100px;height: 40px;display: block;" href="javascript:;" id ="weibo_re_submit">确定</a></li>
            </ol>
        </div>
    </div>

    <!-- 绑定邮箱弹出框 -->
    <div class="s_popup_email">
        <div class="issue_email">
            <span><img src="${pageContext.request.contextPath}/images/system/close.png" /></span>
            <h4>绑定邮箱</h4>
            <ul class="fix">
                <li>
                  <span>邮箱</span>
                  <div class="s_input_box">
                    <input type="text" list="input_list" id="email_account" data-provide="typeahead"  />
                     <datalist id="input_list"></datalist>
                  </div>
                </li>
                <li>
                  <span>密码</span>
                  <div class="s_input_box">
                    <input type="password" id= "email_pawwordOrSky"  />
                  </div>
                </li>

                <span style="float: left;"><em style="margin-left:50px;">仅支持网易、QQ邮箱</em></span>
                <span style="float: right;"><a id ="ahref" style="display: none;color: #03A9F4;text-decoration: none;" href="javascript:;" onclick="ahref()">口令获取教程</a></span>
            </ul>
            <ol class="fix">
                <li><a style="width: 100px;height: 40px;display: block;" href="javascript:;" class="s_cancels">取消</a></li>
                <li><a style="width: 100px;height: 40px;display: block;" href="javascript:;" id="email_submit">绑定</a></li>
            </ol>
        </div>
    </div>
     
    <!-- 解除绑定邮箱弹出框 -->
    <div class="k_popup">
        <div class="k_issue">
            <span><img src="${pageContext.request.contextPath}/images/system/close.png" /></span>
            <h4><img src="${pageContext.request.contextPath}/images/system/warning.png" /> 解除绑定邮箱</h4>
            <p>解除绑定后，您将无法发送邮件,确定解绑邮箱？</p>
            <ol class="fix">
                <li><a style="width: 100px;height: 40px;display: block;" href="javascript:;" class="k_cancel">取消</a></li>
                <li><a style="width: 100px;height: 40px;display: block;" href="javascript:;" id = "mail_remove_submit">确定</a></li>
            </ol>
        </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/system/exit.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/marketing/InputLimited.js"></script>
    <script>
    
    setTimeout(function(){
    	$('#msg3').text("");
    },4000);
  
	   $('#email_account').val(" ");
	   $('#email_pawwordOrSky').val("");
  
 
    function inputList(input,list){
        var mailBox = [
            "@qq.com",
            //"@sina.com",
            "@163.com"
            //"@126.com",
            //"@yahoo.com.cn",
            //"@gmail.com",
            //"@sohu.com"
        ];
        input.bind('input propertychange', function() {
            var key = input.val();
            if(key.indexOf("@") != -1){
                key = key.slice(0,key.indexOf("@"));
            }
            var mailBoxLen = mailBox.length;
            var html = "";
            for(var i=0; i<mailBoxLen; i++){
                html += '<option value="'+ key + mailBox[i] +'"></option>';
            }
            list.html(html);
        });
    }
    inputList($("#email_account"),$("#input_list"));
   $('#email_pawwordOrSky').on("click",function(){
	   var val =$('#email_account').val();
	   if (val.indexOf("@163.com")>0||val.indexOf("@163.COM")>0) {
		   $('em').text("请输入您的网易邮箱密码");
	   }
	   if (val.indexOf("@qq.com")>0||val.indexOf("@qq.COM")>0) {
		   $('em').text("QQ邮箱请输入16位STMP口令");
		   $('#ahref').css("display","block");
	   }
	   
	   $('em').removeClass("hide");
	   $('em').addClass("show");
   });
  function ahref(){
	window.open("http://jingyan.baidu.com/article/fedf0737af2b4035ac8977ea.html");
  };
		    //过期时间判定
		    $(function(){
		    	
		    		 $.ajax({
		        		  url: "${pageContext.request.contextPath}/api/weibo/changebind",
		
		        		  type: "POST",
		        		  
		        		  async: false,
		
		        		 // data:{},
		        		  cache:false,
		
		        		  dataType: "json",
		
		        		  timeout: 1000,
		
		        		  error: function(){},
		
		        		  success: function(data){
		        			
		        			  var returnData = eval(data);
			        			 if (returnData.error_code==0) {
			        				 
			        				$('#msg').text(returnData.RemainingDay+"天后微博授权失效");
			        				$('.k_weibo').hide();
									$('.s_weibo_relieve').show();
								}
			        			 if (returnData.error_code==1) {
			        				 $('.k_weibo').show();
									 $('.s_weibo_relieve').hide();
									 //$('#msg1').text("请重新授权");
								}
		        		   }
		                   
		        		  }); 
		    		//邮箱绑定判定
		    		 $.ajax({
		          		  url: "${pageContext.request.contextPath}/api/weibo/SelectEmailbind",

		          		  type: "post",
		          		  
		          		  async: false,

		          		  data:{},

		          		  dataType: "json",

		          		  timeout: 1000,

		          		  error: function(){},

		          		  success: function(data){
		          		    var returndata = eval(data);
				                    if (data.error_code==0) {
										var ms ="绑定邮箱账号：" +data.mail+" "+"绑定类型：" +data.type;
										$('#msg1').text(ms);
										 $('.k_email').hide();   
		                  				 $('.s_email_relieve').show(); 
		                  				 
									} else {
                                     
                                      $('.k_email').show();   
                       				  $('.s_email_relieve').hide(); 
									}   
				          		  }
		                   
		          		  }); 
		    		//首页显示判断
		    		 $.ajax({
		        		  url: "${pageContext.request.contextPath}/api/weibo/showfirstpage",
		
		        		  type: "POST",
		        		  
		        		  async: false,
		
		        		 // data:{},
		        		  cache:false,
		
		        		  dataType: "json",
		
		        		  timeout: 1000,
		
		        		  error: function(){},
		
		        		  success: function(data){
		        	        var returndata =eval(data);
		        			var status = returndata.showstatus;
			        			if (status=="1") {
			        				 $('.s_fk_pic1 img').attr('src', '${pageContext.request.contextPath}/images/system/s_check_no.png');
			        				
								} else {
									 $('.s_fk_pic1 img').attr('src', '${pageContext.request.contextPath}/images/system/s_check.png');
								}
		        		   }
		                   
		        		  }); 
		    		
		    })
    
    
        $('.s_fk_pic1').click(function(){
          var id = $(this).find('img').attr('_id');
            if(id == 1){
              $('.s_fk_pic1 img').attr('src', '${pageContext.request.contextPath}/images/system/s_check.png');
              
              $(this).find('img').attr('_id' , '0');
            }else{
              $('.s_fk_pic1 img').attr('src', '${pageContext.request.contextPath}/images/system/s_check_no.png');
              
              $(this).find('img').attr('_id' , '1');
            }
            var nestid = $(this).find('img').attr('_id');
	            $.ajax({
	      		  url: "${pageContext.request.contextPath}/api/weibo/updatefirstpage",
	
	      		  type: "POST",
	      		  
	      		  async: false,
	
	      		  data:{"bak5":nestid},
	      		  cache:false,
	
	      		  dataType: "json",
	
	      		  timeout: 1000,
	
	      		  error: function(){},
	
	      		  success: function(data){  }
	                  
	      		  }); 
            
        });
		    
		    
	        $('.s_popup .issue #weibo_re_submit').click(function(){
	        
	        	window.open("${pageContext.request.contextPath}/api/weibo/removebind");
	        	$('.s_popup .issue').hide();
	        	window.location.reload();
	        });
	        $('.s_popup .issue span,.s_cancel').click(function(){
	            $('.s_popup,.issue').hide();
	        });

	        $('.k_weibo').click(function(){
// 	            $(this).hide();
	            //绑定 微博
	            window.location.href="${pageContext.request.contextPath}/api/weibo/bindGetToken";
	            
	           //$('.s_weibo_relieve').show();
	        });

	        $('.s_weibo_relieve').click(function(){
	        	//解绑弹出
	            $('.s_popup,.issue').show();
	        });
              //邮箱
	        $('.k_email').click(function(){
	          $('.s_popup_email,.issue_email').show();
// 	           $(this).hide();
// 	            $('.s_email_relieve').show();
	        });
              $('#email_submit').click(function(){
            	  
            	
            	  
            	  var emailAccount = $('#email_account').val().trim();
            	  var emailPawwordOrSky =$('#email_pawwordOrSky').val().trim();
            	  //alert(emailAccount);
            	 if (emailAccount!=null&&emailAccount!=""&&emailPawwordOrSky!=null&&emailPawwordOrSky!="") {
            		 $.ajax({
                  		  url: "${pageContext.request.contextPath}/api/weibo/Emailbind",

                  		  type: "post",
                  		  
                  		  async: false,

                  		  data:{"EmailAccount":emailAccount,"EmailPawwordOrSky":emailPawwordOrSky},

                  		  dataType: "json",

                  		  timeout: 1000,

                  		  error: function(){},

                  		  success: function(data){
                  			 var returndata =eval(data);    
                  			 if (returndata.error_code==0) { 		
                  				 //alert("绑定成功"); 								
                  				  $('.s_popup_email,.issue_email').hide(); 	
   				                  $('.k_email').hide();  
                  				 $('.s_email_relieve').show();    
                  				 window.location.reload();
                  				 } else { 	
                  					// alert(returndata.message); 
                  					 //$('.s_popup_email,.issue_email').hide();
                  					 showDialog(returndata.message);
                  					// $('.s_popup_email,.issue_email').show();
                  					
                  			     }
                  			 
                  		  }
                               
                  		  }); 
				} else {
                   alert("信息不能为空");
				}
              });

	        $('.s_email_relieve').click(function(){
	            $('.k_popup,.k_issue').show();
	        });
	        $('#mail_remove_submit').click(function(){
	        	 $.ajax({
	          		  url: "${pageContext.request.contextPath}/api/weibo/removeEmailbind",

	          		  type: "post",
	          		  
	          		  async: false,

	          		  data:{},

	          		  dataType: "json",

	          		  timeout: 1000,

	          		  error: function(){},

	          		  success: function(data){
	          		    var returndata = eval(data);
			                       if (returndata.error_code==1) {
									//alert(returndata.message);
									$('.k_popup,.k_issue').hide();
									$('.s_email_relieve').hide(); 
	                  				$('.k_email').show();  
	                  				window.location.reload();
								} else {
									alert(returndata.message);
								}
			          		  }
	                   
	          		  }); 
	        });

	        $('.s_cancels,.issue_email span').click(function(){
	     	   $('#email_account').val(" ");
	    	   $('#email_pawwordOrSky').val("");
	          $('.s_popup_email,.issue_email').hide();
	        });

	        $('.k_cancel,.k_issue span').click(function(){
	            $('.k_popup,.k_issue').hide();
	        });
        
        //绑定微博
//         $('#binding').click(function(){
        	
//         	window.location.href="${pageContext.request.contextPath}/api/weibo/bindGetToken";
//         })
      
        //解除绑定
//          $('#jiebind').click(function(){
//         	window.open("wbjiebang");
//         })
        function showDialog(title){
		$('#dialog_title').html('<img src="../bm/images/s_tick.png"/>'+title+''); 
		$('.s_popup_delect2,.s_consum').show().delay(2000).fadeOut();
	}
        
    </script>
    <script type="text/javascript">
    $(function(){
	    $.post("${pageContext.request.contextPath}/api/company/show",function(data){
			if(data.error_code == "20028"){
				showDialog(" 账户已被登陆，请重新登陆。");
				setTimeout('window.location.href="http://scrm.cecook.cn/"',2000);
			}
			/* 关键字 */
			var kw = data.keyword;
			var arr = kw.split(",");
			if(arr[0] != ""){
				for(var i = 0 ; i < arr.length;i++){
					$('#kf').append('<div><div>'+arr[i]+'<img class="del" src="${pageContext.request.contextPath}/images/system/del-1.png"/></div></div>');
				}
			} 
			kfl = "y";
			doch();
		});
    });
    </script>
    <script type="text/javascript">
    $('.s_keyword input').on('keydown',function(e){
        $(this).parents('.s_keyword').find('span').show();
        if(e.keyCode==13){
            var keyword = $.trim($('.s_keyword input').val());
            var html = "";
            var len = $('.key>div').length;

            var newLen = $('.key>div').length;
            if(len>4){
                $('.s_keyword input').hide();
                $('.s_keyword em').show();
            }
            if(!keyword==""){
                if(len>=5){
                    return false;
                }
                if(keyword.indexOf(',') != -1 || keyword.indexOf('，') != -1 || keyword.indexOf('、') != -1){
					showDialog("不能添加逗号、顿号");
					$('.s_keyword input').val('');
					return false;
                }
                html = "<div><div>"+keyword+"<img class='del' src='${pageContext.request.contextPath}/images/system/del-1.png'/></div></div>"
            }
            /*判断关键字不能相同   start*/
            var kfs = $('#kf').children(); 
            var fflag = true;
            kfs.each(function(){
				var cf = $(this).text();
					if(cf == keyword){
						fflag = false;
						return ;
					}
			}); 
             if(fflag){
            	 	$('.key').append(html);
					$('.s_keyword input').val('');
	                $(this).parents('.s_keyword').find('span').hide()
             }else{
            	 	showDialog("不能重复添加相同的关键字");
					$('.s_keyword input').val('');
             }
             len = $('.key>div').length;
             if(len>4){
                 $('.s_keyword input').hide();
                 $('.s_keyword em').show();
             }
        }
    });

    $('body').on('click','.del',function(){
        $('.form input').show();
        $('.s_keyword em').hide();
        $(this).parent().parent().remove();
    });
    var kfl ;
	function doch(){
		if(kfl == "y"){
			var kfss = $('#kf').children();
			if(kfss.length == 5){
				$('#i,#s').hide();
				$('#e').show();
			}
		}
	}
	$('.addEle').on('keydown',function(e){
        var ele = "";
        if(e.keyCode==13){
            var con = $.trim($(this).val());
            if(con==""){
                $(this).val('');
                return false;
            }
            if(itemNum>=3){
                return false;
            }
            itemNum++;
            if(itemNum==3){
                $('.addEle').css('visibility','hidden');
                $('.showDialogWord').css('visibility','hidden');
            }
            ele = '<li class="s_fx_li1 c_li"><img src="${pageContext.request.contextPath}/images/system/s_check.png" class="c_'+itemNum+'" _id="c_'+itemNum+'" />'+con+' <img class="k_del" src="images/k_close.png" /></li>';
            $('.s_login_box ol').append(ele);
            $(this).val('');
        }
    })
    </script>
    <script type="text/javascript">
    	function saveKW(){
    		var kfs = $('#kf').children();
			var keyword ="";
			for(var i = 0 ; i < kfs.length ; i++){
				var k = kfs[i];
				if(i == kfs.length - 1 ){
					keyword += $(k).children().text();
				}else{
					keyword += $(k).children().text()+",";
				}
    		}
			$.post("${pageContext.request.contextPath}/api/company/updateKeyWords",{"keyword":keyword},function(data){
				if(data.error_code == "20028"){
					showDialog(" 账户已被登陆，请重新登陆。");
					setTimeout('window.location.href="http://scrm.cecook.cn/"',2000);
				}
				if("0" == data.error_code){
					showDialog("修改成功");
					window.location.reload();
				}else{
					showDialog(data.message);
				}
			});
			
    	}
    </script>
    <script type="text/javascript">
		var auths = "<%=session.getAttribute("authoritys")%>";
	</script>
</body>
</html>